IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'spTreleasereason_RetrieveAll')
	BEGIN
		PRINT 'Dropping Procedure spTreleasereason_RetrieveAll'
		DROP  Procedure  spTreleasereason_RetrieveAll
	END

GO

PRINT 'Creating Procedure spTreleasereason_RetrieveAll'
GO

CREATE Procedure spTreleasereason_RetrieveAll
	(
		@releasereasonid int = null, 
		@releasereason varchar(200) = null, 
		@description varchar(100) = null, 
		@active numeric = null
	)
AS
    /* 
    ------------------------------------------------------------------------------
    - Change History
    - --------------
    - Date          Description
    ------------------------------------------------------------------------------
    - 8/23/2007	Initial version created
    ------------------------------------------------------------------------------
    */
	
	SET NOCOUNT ON
	
	-- Retrieve the relevant records
	SELECT  *
	FROM	Treleasereason
	
	WHERE	(@releasereasonid IS NULL OR Treleasereason.releasereasonid = @releasereasonid)
	  AND	(@releasereason IS NULL OR Treleasereason.releasereason LIKE @releasereason + '%')
	  AND	(@description IS NULL OR Treleasereason.description LIKE @description + '%')
	  AND	(@active IS NULL OR Treleasereason.active = @active)

	-- Return to calling method
	RETURN
GO
